#include "pch.h"
#include "PEInfo.h"
#include <vector>

using namespace CoreInterface;
using namespace Platform;

Platform::Array<ImageDataDirectory^>^ CoreInterface::ImageOptionalHeader::Get_DataDirectory()
{
	ImageDataDirectory^ pItem[IMAGE_NUMBEROF_DIRECTORY_ENTRIES] = { nullptr };

	for (int i = 0; i < IMAGE_NUMBEROF_DIRECTORY_ENTRIES; ++i)
	{
		pItem[i] = ref new ImageDataDirectory();
		pItem[i]->Set_VirtualAddress(DataDirectory[i].VirtualAddress);
		pItem[i]->Set_Size(DataDirectory[i].Size);
	}
	return ref new Array<ImageDataDirectory^>(pItem, IMAGE_NUMBEROF_DIRECTORY_ENTRIES);
}

void CoreInterface::ImageSectionHeader::Set_Name(const Platform::Array<byte>^ value)
{
	if (value->Length <= IMAGE_SIZEOF_SHORT_NAME)
	{
		for (unsigned index = 0; index < value->Length; ++index)
		{
			Name[index] = value->get(index);
		}
	}
}

CoreInterface::ImageNtHeaders::ImageNtHeaders()
{
	
}
